package org.jmat.mapping;

import org.jmat.entities.Person;
import org.springframework.batch.item.file.mapping.FieldSet;
import org.springframework.batch.item.file.mapping.FieldSetMapper;

public class PersonFieldSetMapper implements FieldSetMapper {

	public Object mapLine(FieldSet fs) {
		
		if(fs == null){
			return null;
		}
		
		Person person = new Person();
		person.setId(fs.readInt("id"));
		person.setName(fs.readString("name"));
		person.setFirstname(fs.readString("firstname"));
		person.setBirthday(fs.readDate("birthday"));
		
		return person;
	}

}
